class Solution {
public:
    void dfs(string& s, int index)
    {
        if (index == s.size())
        {
            ret.push_back(path);
            return;
        }

        if (isalpha(s[index]))
        {
            path += toupper(s[index]);
            dfs(s, index + 1);
            path.pop_back();

            path += tolower(s[index]);
            dfs(s, index + 1);
            path.pop_back();
        }
        else
        {
            path += s[index];
            dfs(s, index + 1);
            path.pop_back();
        }
    }
    vector<string> letterCasePermutation(string s) {
        dfs(s, 0);

        return ret;
    }
private:
    vector<string> ret;
    string path;
};